package com.tenbent.product.base.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import com.tenbent.product.base.utils.SpringContextUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TenbentListener implements ServletContextListener {

	public static final Logger logger = LoggerFactory.getLogger(TenbentListener.class);

	public void contextDestroyed(ServletContextEvent event) {

		logger.debug("tenbent_listener is destoryed....!");
		logger.debug("removed spring context the spring context util SpringContextUtil");
		SpringContextUtil.setContext(null);
	}

	public void contextInitialized(ServletContextEvent event) {

		logger.debug("tenbent_listener is initialized....!");
		// 此种方式在spring3以后不太这样配置
		// ApplicationContext wac =
		// WebApplicationContextUtils.getWebApplicationContext(event.getServletContext(),);
		// SpringContextUtil.setContext(wac);
		// logger.debug("initialized spring context the spring context util
		// SpringContextUtil");
	}

}
